package com.margo.project.netty.zk.factories;

import com.margo.project.netty.zk.bean.MargoZKRequest;
import com.margo.project.netty.zk.bean.create.MargoZKCreateRequest;
import com.margo.project.netty.zk.registrys.MargoZKCaches;
import com.margo.project.netty.zk.zkcodec.create.MargoZKCreateCodec;

import io.netty.handler.codec.ByteToMessageCodec;

public class MargoZKCodecFactories {
    public static ByteToMessageCodec getCodec(MargoZKRequest zkRequest, MargoZKCaches codecRegistry) throws IllegalAccessException {
        if(zkRequest instanceof MargoZKCreateRequest){
             return new MargoZKCreateCodec(codecRegistry);
        }

         throw new IllegalAccessException("cannot find codecs for " + zkRequest.getClass());
     }
}
